package postjnlv2_param.view;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTextArea;

public class Rapport_Detail_View extends JFrame{	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;		
	private Font font = new Font("Arial", Font.BOLD, 10);
	public JPanel rapport_Panel;
	public JPanel center_north;
	public JPanel center_south;
	public JTextArea rqSuccess,rqImportant;
	public JProgressBar barreProgression;
	public JLabel txt;
	public JLabel lbTitle,lbJnlEndDt,lbJnlRefNo,lbIdRun,lbUpdate1,lbUpdate2,lbProcStock;
	public JLabel lbJnlEndDtRes,lbJnlRefNoRes,lbIdRunRes,lbUpdate1Res,lbUpdate2Res,lbProcStockRes;
	public JLabel lbEquiv1,lbEquiv2,lbEquiv3,lbEquiv4,lbEquiv5,lbEquiv6;
	
	
	public Rapport_Detail_View(){
		
		center_north=new JPanel();
		center_north.setBackground(Color.WHITE);
		center_north.setLayout(new GridBagLayout());
		center_south=new JPanel();
		center_south.setBackground(Color.WHITE);
		center_south.setLayout(new BorderLayout());
		
		//PANEL NORD
		
		//progressBar
        GridBagConstraints gridBagConstraintsProgressBar = new GridBagConstraints();
        barreProgression= new JProgressBar();
        barreProgression.setPreferredSize(new Dimension(250,15));
        barreProgression.setStringPainted(true);
        gridBagConstraintsProgressBar.gridx = 0;
        gridBagConstraintsProgressBar.gridy = 0;
        gridBagConstraintsProgressBar.insets = new Insets(5, 0, 10, 50);
        gridBagConstraintsProgressBar.anchor = gridBagConstraintsProgressBar.WEST;
        center_north.add(barreProgression, gridBagConstraintsProgressBar);
        
		//Debut generation Facture
		GridBagConstraints gridBagConstraintsTitle = new GridBagConstraints();
		lbTitle = new JLabel("Début du traitement POSTJNLv2");
		lbTitle.setFont(font);
		gridBagConstraintsTitle.gridx = 0;
		gridBagConstraintsTitle.gridy = 1;
		gridBagConstraintsTitle.insets = new Insets(4, 2, 4, 80);
		gridBagConstraintsTitle.anchor = gridBagConstraintsTitle.WEST;
		center_north.add(lbTitle, gridBagConstraintsTitle);
        lbTitle.setVisible(false);
        
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
		txt = new JLabel("...");
		txt.setFont(font);
		gridBagConstraints.gridx = 1;
		gridBagConstraints.gridy = 1;
		gridBagConstraints.insets = new Insets(4, 40, 4, 2);
		gridBagConstraints.anchor = gridBagConstraints.WEST;
		center_north.add(txt, gridBagConstraints);
		txt.setVisible(false);
        
		        
		//Modif fichier temp
		GridBagConstraints gridBagConstraintsEndDt = new GridBagConstraints();
		lbJnlEndDt = new JLabel("Récuperation MAX(JNL_END_DT)");
		lbJnlEndDt.setFont(font);
		gridBagConstraintsEndDt.gridwidth =2;
		gridBagConstraintsEndDt.gridx = 0;
		gridBagConstraintsEndDt.gridy = 2;
		gridBagConstraintsEndDt.insets = new Insets(4, 2, 4, 5);
		gridBagConstraintsEndDt.anchor = gridBagConstraintsEndDt.WEST;
		center_north.add(lbJnlEndDt, gridBagConstraintsEndDt);
		lbJnlEndDt.setVisible(false);
        
        GridBagConstraints gridBagConstraintsEquiv1 = new GridBagConstraints();
        lbEquiv1=new JLabel("==>");
        lbEquiv1.setFont(font);
        gridBagConstraintsEquiv1.gridx = 2;
        gridBagConstraintsEquiv1.gridy = 2;
        gridBagConstraintsEquiv1.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv1.anchor = gridBagConstraintsEquiv1.WEST;
        center_north.add(lbEquiv1, gridBagConstraintsEquiv1);
        lbEquiv1.setVisible(false);
        
        GridBagConstraints gridBagConstraintsEndDtRes = new GridBagConstraints();
        lbJnlEndDtRes=new JLabel("En cours");
        lbJnlEndDtRes.setFont(font);
        lbJnlEndDtRes.setForeground(Color.blue);
        gridBagConstraintsEndDtRes.gridx = 3;
        gridBagConstraintsEndDtRes.gridy = 2;
        gridBagConstraintsEndDtRes.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEndDtRes.anchor = gridBagConstraintsEndDtRes.WEST;
        center_north.add(lbJnlEndDtRes, gridBagConstraintsEndDtRes);
        lbJnlEndDtRes.setVisible(false);
        
        //Modification onglet imput
      	GridBagConstraints gridBagConstraintsRefNo = new GridBagConstraints();
      	lbJnlRefNo = new JLabel("Récuperation MAX(JNL_REF_NO)");
      	lbJnlRefNo.setFont(font);
      	gridBagConstraintsRefNo.gridwidth =2;
      	gridBagConstraintsRefNo.gridx = 0;
      	gridBagConstraintsRefNo.gridy = 3;
      	gridBagConstraintsRefNo.insets = new Insets(4, 2, 4, 5);
      	gridBagConstraintsRefNo.anchor = gridBagConstraintsRefNo.WEST;
      	center_north.add(lbJnlRefNo, gridBagConstraintsRefNo);
      	lbJnlRefNo.setVisible(false);
          
        GridBagConstraints gridBagConstraintsEquiv2 = new GridBagConstraints();
        lbEquiv2=new JLabel("==>");
        lbEquiv2.setFont(font);
        gridBagConstraintsEquiv2.gridx = 2;
        gridBagConstraintsEquiv2.gridy = 3;
        gridBagConstraintsEquiv2.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv2.anchor = gridBagConstraintsEquiv2.WEST;
        center_north.add(lbEquiv2, gridBagConstraintsEquiv2);
        lbEquiv2.setVisible(false);
          
        GridBagConstraints gridBagConstraintsRefNoRes = new GridBagConstraints();
        lbJnlRefNoRes = new JLabel("En cours");
        lbJnlRefNoRes.setFont(font);
        lbJnlRefNoRes.setForeground(Color.blue);
        gridBagConstraintsRefNoRes.gridx = 3;
        gridBagConstraintsRefNoRes.gridy = 3;
        gridBagConstraintsRefNoRes.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsRefNoRes.anchor = gridBagConstraintsRefNoRes.WEST;
        center_north.add(lbJnlRefNoRes, gridBagConstraintsRefNoRes);
        lbJnlRefNoRes.setVisible(false);
              
        //Copie donnée temp ==> abo
      	GridBagConstraints gridBagConstraintsIdRun = new GridBagConstraints();
      	lbIdRun = new JLabel("Récuperation T_ID_RUN");
      	lbIdRun.setFont(font);
      	gridBagConstraintsIdRun.gridwidth =2;
      	gridBagConstraintsIdRun.gridx = 0;
      	gridBagConstraintsIdRun.gridy = 4;
      	gridBagConstraintsIdRun.insets = new Insets(4, 2, 4, 5);
      	gridBagConstraintsIdRun.anchor = gridBagConstraintsIdRun.WEST;
      	center_north.add(lbIdRun, gridBagConstraintsIdRun);
      	lbIdRun.setVisible(false);
              
        GridBagConstraints gridBagConstraintsEquiv3 = new GridBagConstraints();
        lbEquiv3=new JLabel("==>");
        lbEquiv3.setFont(font);
        gridBagConstraintsEquiv3.gridx = 2;
        gridBagConstraintsEquiv3.gridy = 4;
        gridBagConstraintsEquiv3.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv3.anchor = gridBagConstraintsEquiv3.WEST;
        center_north.add(lbEquiv3, gridBagConstraintsEquiv3);
        lbEquiv3.setVisible(false);
              
        GridBagConstraints gridBagConstraintsIdRunRes = new GridBagConstraints();
        lbIdRunRes = new JLabel("En cours");
        lbIdRunRes.setFont(font);
        lbIdRunRes.setForeground(Color.blue);
        gridBagConstraintsIdRunRes.gridx = 3;
        gridBagConstraintsIdRunRes.gridy = 4;
        gridBagConstraintsIdRunRes.insets = new Insets(4, 0, 4, 5);
  		gridBagConstraintsIdRunRes.anchor = gridBagConstraintsIdRunRes.WEST;
        center_north.add(lbIdRunRes, gridBagConstraintsIdRunRes);
        lbIdRunRes.setVisible(false);
              
              
        //Mis a jour des données FAS
        GridBagConstraints gridBagConstraintsUpdate1 = new GridBagConstraints();
      	lbUpdate1 = new JLabel("Mis à jour de la table 'CPTL_TRT01_POSTJNLV2_ARCH'");
      	lbUpdate1.setFont(font);
      	gridBagConstraintsUpdate1.gridwidth =2;
      	gridBagConstraintsUpdate1.gridx = 0;
      	gridBagConstraintsUpdate1.gridy = 5;
      	gridBagConstraintsUpdate1.insets = new Insets(4, 2, 4, 5);
      	gridBagConstraintsUpdate1.anchor = gridBagConstraintsUpdate1.WEST;
      	center_north.add(lbUpdate1, gridBagConstraintsUpdate1);
      	lbUpdate1.setVisible(false);
        
        GridBagConstraints gridBagConstraintsEquiv4 = new GridBagConstraints();
        lbEquiv4=new JLabel("==>");
        lbEquiv4.setFont(font);
        gridBagConstraintsEquiv4.gridx = 2;
        gridBagConstraintsEquiv4.gridy = 5;
        gridBagConstraintsEquiv4.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv4.anchor = gridBagConstraintsEquiv4.WEST;
        center_north.add(lbEquiv4, gridBagConstraintsEquiv4);
        lbEquiv4.setVisible(false);
              
        GridBagConstraints gridBagConstraintsUpdate1Res = new GridBagConstraints();
        lbUpdate1Res = new JLabel("En cours");
        lbUpdate1Res.setFont(font);
        lbUpdate1Res.setForeground(Color.blue);
        gridBagConstraintsUpdate1Res.gridx = 3;
        gridBagConstraintsUpdate1Res.gridy = 5;
        gridBagConstraintsUpdate1Res.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsUpdate1Res.anchor = gridBagConstraintsUpdate1Res.WEST;
  		center_north.add(lbUpdate1Res, gridBagConstraintsUpdate1Res); 
  		lbUpdate1Res.setVisible(false);
  		
  		//Mis a jour des données USAGE
        GridBagConstraints gridBagConstraintsUpdate2 = new GridBagConstraints();
        lbUpdate2 = new JLabel("Mis à jour de la table 'JNL_RUNS_STATUS'");
        lbUpdate2.setFont(font);
        gridBagConstraintsUpdate2.gridwidth =2;
        gridBagConstraintsUpdate2.gridx = 0;
        gridBagConstraintsUpdate2.gridy = 6;
      	gridBagConstraintsUpdate2.insets = new Insets(4, 2, 4, 5);
      	gridBagConstraintsUpdate2.anchor = gridBagConstraintsUpdate2.WEST;
      	center_north.add(lbUpdate2, gridBagConstraintsUpdate2);
      	lbUpdate2.setVisible(false);
        
        GridBagConstraints gridBagConstraintsEquiv5 = new GridBagConstraints();
        lbEquiv5=new JLabel("==>");
        lbEquiv5.setFont(font);
        gridBagConstraintsEquiv5.gridx = 2;
        gridBagConstraintsEquiv5.gridy = 6;
        gridBagConstraintsEquiv5.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv5.anchor = gridBagConstraintsEquiv5.WEST;
        center_north.add(lbEquiv5, gridBagConstraintsEquiv5);
        lbEquiv5.setVisible(false);
              
        GridBagConstraints gridBagConstraintsUpdate2Res = new GridBagConstraints();
        lbUpdate2Res = new JLabel("En cours");
        lbUpdate2Res.setFont(font);
        lbUpdate2Res.setForeground(Color.blue);
        gridBagConstraintsUpdate2Res.gridx = 3;
        gridBagConstraintsUpdate2Res.gridy = 6;
        gridBagConstraintsUpdate2Res.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsUpdate2Res.anchor = gridBagConstraintsUpdate2Res.WEST;
        center_north.add(lbUpdate2Res, gridBagConstraintsUpdate2Res);
        lbUpdate2Res.setVisible(false);
  		
  		//Recapitulatif
        GridBagConstraints gridBagConstraintsProc = new GridBagConstraints();
        lbProcStock = new JLabel("Modification en dur de la proc 'get_id_run_src_extourne_pca'");
        lbProcStock.setFont(font);
        gridBagConstraintsProc.gridwidth =2;
        gridBagConstraintsProc.gridx = 0;
        gridBagConstraintsProc.gridy = 7;
        gridBagConstraintsProc.insets = new Insets(4, 2, 4, 5);
        gridBagConstraintsProc.anchor = gridBagConstraintsProc.WEST;
      	center_north.add(lbProcStock, gridBagConstraintsProc);
      	lbProcStock.setVisible(false);
        
        GridBagConstraints gridBagConstraintsEquiv6 = new GridBagConstraints();
        lbEquiv6=new JLabel("==>");
        lbEquiv6.setFont(font);
        gridBagConstraintsEquiv6.gridx = 2;
        gridBagConstraintsEquiv6.gridy = 7;
        gridBagConstraintsEquiv6.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsEquiv6.anchor = gridBagConstraintsEquiv6.WEST;
        center_north.add(lbEquiv6, gridBagConstraintsEquiv6);
        lbEquiv6.setVisible(false);
              
        GridBagConstraints gridBagConstraintsProcRes = new GridBagConstraints();
        lbProcStockRes = new JLabel("En cours");
        lbProcStockRes.setFont(font);
        lbProcStockRes.setForeground(Color.blue);
        gridBagConstraintsProcRes.gridx = 3;
        gridBagConstraintsProcRes.gridy = 7;
        gridBagConstraintsProcRes.insets = new Insets(4, 0, 4, 5);
        gridBagConstraintsProcRes.anchor = gridBagConstraintsProcRes.WEST;
        center_north.add(lbProcStockRes, gridBagConstraintsProcRes);
        lbProcStockRes.setVisible(false);		
         
        center_south.add(remarqueImportant(),BorderLayout.NORTH);	
        center_south.add(remarqueSuccess(),BorderLayout.SOUTH);	
		
	}					
	
	//PANEL SUD
	public JTextArea remarqueSuccess(){		
		rqSuccess= new JTextArea("Note :\nUne fois le package 'Cptl_Trt01_Postjnlv2_Pkg' compilé:\nVous pourrez lancer le traitement PostJNLV2\n" +
				"en mode normal, puis vérifiez les logs et voir les fichiers \n"+
				"générés sous « /arbor117/data/jnl/TRT01/output » de D3");
		rqSuccess.setPreferredSize(new Dimension(390,100));
		rqSuccess.setLineWrap(true);		
		rqSuccess.setVisible(false);
		return rqSuccess;		
	}
	
	public JTextArea remarqueImportant(){		
		rqImportant= new JTextArea("Très important :\nVeuillez recompiler la procédure stockée dans le BODY du\n" +
		"PACKAGE Cptl_Trt01_Postjnlv2_Pkg de la base D3 CC_CUST");
		rqImportant.setForeground(Color.red);
		rqImportant.setPreferredSize(new Dimension(390,60));
		rqImportant.setLineWrap(true);
		rqImportant.setVisible(false);
		return rqImportant;		
	}
	
}
